// Copyright Epic Games, Inc. All Rights Reserved.

#pragma once

#include "Kismet/BlueprintFunctionLibrary.h"

#include "InteractionStatics.generated.h"

template <typename InterfaceType> class TScriptInterface;

class AActor;
class IInteractableTarget;
class UObject;
struct FFrame;
struct FHitResult;
struct FOverlapResult;

/**
 * 交互静态函数库，提供与交互相关的实用函数
 */
UCLASS()
class UInteractionStatics : public UBlueprintFunctionLibrary
{
	GENERATED_BODY()

public:
	UInteractionStatics(); // 构造函数

public:
	/**
	 * 从可交互目标接口获取Actor
	 * @param InteractableTarget 可交互目标接口
	 * @return 返回对应的Actor指针
	 */
	UFUNCTION(BlueprintCallable)
	static AActor* GetActorFromInteractableTarget(TScriptInterface<IInteractableTarget> InteractableTarget);

	/**
	 * 从Actor获取所有可交互目标
	 * @param Actor 要检查的Actor
	 * @param OutInteractableTargets 输出的可交互目标数组
	 */
	UFUNCTION(BlueprintCallable)
	static void GetInteractableTargetsFromActor(AActor* Actor, TArray<TScriptInterface<IInteractableTarget>>& OutInteractableTargets);

	/**
	 * 从重叠结果中追加可交互目标
	 * @param OverlapResults 重叠结果数组
	 * @param OutInteractableTargets 输出的可交互目标数组
	 */
	static void AppendInteractableTargetsFromOverlapResults(const TArray<FOverlapResult>& OverlapResults, TArray<TScriptInterface<IInteractableTarget>>& OutInteractableTargets);

	/**
	 * 从命中结果中追加可交互目标
	 * @param HitResult 命中结果
	 * @param OutInteractableTargets 输出的可交互目标数组
	 */
	static void AppendInteractableTargetsFromHitResult(const FHitResult& HitResult, TArray<TScriptInterface<IInteractableTarget>>& OutInteractableTargets);
};